package com.wyd.principle.InterfaceSegregation;

public class InterfaceSegregationDemo02 {
}

/**
 * 将原 IOperation 进行拆分
 */
interface IOperationA{
    void operation1();
}
interface IOperationB{
    void operation2();
    void operation3();
}

interface IOperationC{
    void operation4();
    void operation5();
}

class OperationImplAA implements IOperationA, IOperationB{
    public void operation1() {
        System.out.println("OperationImplA 实现了 operation1");
    }

    public void operation2() {
        System.out.println("OperationImplA 实现了 operation2");
    }

    public void operation3() {
        System.out.println("OperationImplA 实现了 operation3");
    }
}

class OperationImplBB implements IOperationA, IOperationC{
    public void operation1() {
        System.out.println("OperationImplB 实现了 operation1");
    }

    public void operation4() {
        System.out.println("OperationImplB 实现了 operation4");
    }

    public void operation5() {
        System.out.println("OperationImplB 实现了 operation5");
    }
}

class UserAA{
    public void operation1(IOperationA operationA, IOperationB operationB){
        operationA.operation1();
        operationB.operation2();
        operationB.operation3();
    }
}

class UserBB {
    public void operation1(IOperationA operationA, IOperationC operationC) {
        operationA.operation1();
        operationC.operation4();
        operationC.operation5();
    }
}
